# eRepublik Helper Utilities
#
# Authors:
#   Wang Rui <wangray84@gmail.com>

PROJECT( eRepHelper )
SET( PROJECT_NAME eRepHelper )

CMAKE_MINIMUM_REQUIRED( VERSION 2.6.0 FATAL_ERROR )
IF( COMMAND CMAKE_POLICY )
  CMAKE_POLICY( SET CMP0003 NEW )
ENDIF( COMMAND CMAKE_POLICY )

SET( CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules/;${CMAKE_MODULE_PATH}" )
SET( CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows" )

FIND_PACKAGE( Qt4 )

IF( WIN32 )
    IF( MSVC )
        OPTION( WIN32_USE_MP "Set to ON to build with the /MP option (Visual Studio 2005 and above)." OFF )
        MARK_AS_ADVANCED( WIN32_USE_MP )
        IF( WIN32_USE_MP )
            SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP" )
        ENDIF( WIN32_USE_MP )
        
        ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS )
        ADD_DEFINITIONS( -D_CRT_SECURE_NO_DEPRECATE )
    ENDIF( MSVC )
ELSE( WIN32 )
    SET( CMAKE_CXX_FLAGS "-W -Wall -Wno-unused" )
ENDIF( WIN32 )

INCLUDE( CustomModules )
INCLUDE_DIRECTORIES( ${CMAKE_INCLUDE_PATH} )
LINK_DIRECTORIES( ${CMAKE_LIBRARY_PATH} )

ADD_SUBDIRECTORY( counselor )
ADD_SUBDIRECTORY( test )

CONFIGURE_FILE(
    "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
    IMMEDIATE @ONLY )
ADD_CUSTOM_TARGET( uninstall
                   "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
)